import { pageList, detail } from './comInstance'
import { DBNames } from '@/enum/dbName'

// 园区分页列表
export interface IDicCode {
  name: string
  type: number
  typeKey: string
}

export interface IPageInfo {
  pageNum: number
  pageSize: number
}

export interface IPageListParams {
  conditions?: Record<string, unknown>
  dicCodes?: IDicCode[]
  fields?: Record<string, unknown>
  pageInfo?: IPageInfo
  sort?: Record<string, unknown>
}

// 土地
export const getLandPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_LAND })
}

export const getLandDetail = (id: string) => {
  return detail({ id, templateName: DBNames.B_CONSOLE_LAND })
}

// 厂房
export const getWorkshopPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_WORKSHOP })
}

export const getWorkshopDetail = (id: string) => {
  return detail({ id, templateName: DBNames.B_CONSOLE_WORKSHOP })
}

// 写字楼
export const getBuildingPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_BUILDING })
}

export const getBuildingDetail = (id: string) => {
  return detail({ id, templateName: DBNames.B_CONSOLE_BUILDING })
}

// 仓库
export const getDepositoryPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_DEPOSITORY })
}

export const getDepositoryDetail = (id: string) => {
  return detail({ id, templateName: DBNames.B_CONSOLE_DEPOSITORY })
}

// 商铺
export const getShopPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_SHOP })
}

export const getShopDetail = (id: string) => {
  return detail({ id, templateName: DBNames.B_CONSOLE_SHOP })
}
// 项目
export const getProjectPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_PROJECT })
}

export const getProjectDetail = (id: string) => {
  return detail({ id, templateName: DBNames.B_CONSOLE_PROJECT })
}
// 商协会
export const getCommercePageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_COMMERCE })
}

export const getCommerceDetail = (id: string) => {
  return detail({ id, templateName: DBNames.B_CONSOLE_COMMERCE })
}
